/*
 *  This file is part of WWWPal.
 *
 *  Copyright (C) 2003  Dr. John Punin, Department of Computer Science
 *  Rensselaer Polytechnic Institute
 *
 *  WWWPal is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  WWWPal is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Foobar; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/*
 *  This file is part of WWWPal.
 *
 *  Copyright (C) 2003  Dr. John Punin, Department of Computer Science
 *  Rensselaer Polytechnic Institute
 *
 *  WWWPal is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  WWWPal is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Foobar; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#ifndef LOGR_BROWSERS_H
#define LOGR_BROWSERS_H

#include <sys/stat.h>
#include <sys/fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <ctype.h>
#include <sys/time.h>
#include <assert.h>
#include <gr_graph_fun.h>

typedef enum _type_browser {
    BNETSCAPE = 1, BMSIE, OTHER_NETSCAPE_COMP, BOPERA, BLYNX, OTHER_BROWSER
} TypeBrowser;

typedef enum _type_platform {
    PWINDOWS98 = 1, PWINDOWS95, PWINDOWSNT, PMACINTOSH, PUNIX, PWINDOWS31, POS2, OTHER_PLATFORM
} TypePlatform;

typedef enum _type_version {
    V2 = 1 ,V3,V4,V5,OTHER_VERSION
} TypeVersion;

typedef struct _web_browser_node {
    char * ua;
    long naccesses;
    double sbytes;
    long npages;
    TypeVersion tv;
    TypeBrowser tb;
    TypePlatform tp;
    short is_spider;
} WebBrowserNodeStruct;

typedef struct _web_browser_node *WebBrowserNodePtr;


WebBrowserNodePtr
new_web_browser_node(void);

void
delete_web_browser_node(WebBrowserNodePtr wbn);

void
LOGR_set_user_agent(WebBrowserNodePtr wbn,char *sua);

const char *
LOGR_get_user_agent(WebBrowserNodePtr wbn);

void
LOGR_set_is_spider(WebBrowserNodePtr wbn);

void
LOGR_set_is_browser(WebBrowserNodePtr wbn);

short
LOGR_is_spider(WebBrowserNodePtr wbn);

void
LOGR_set_browser_naccesses(WebBrowserNodePtr wbn,long num);

void
LOGR_inc_browser_naccesses(WebBrowserNodePtr wbn);

long
LOGR_get_browser_naccesses(WebBrowserNodePtr wbn);

void
LOGR_set_browser_npages(WebBrowserNodePtr wbn,long num);

void
LOGR_inc_browser_npages(WebBrowserNodePtr wbn);

long
LOGR_get_browser_npages(WebBrowserNodePtr wbn);

void
LOGR_set_browser_sizebytes(WebBrowserNodePtr wbn,double num);

void
LOGR_add_browser_sizebytes(WebBrowserNodePtr wbn,double num);

double
LOGR_get_browser_sizebytes(WebBrowserNodePtr wbn);

int
LOGR_is_accessb_lower(WebBrowserNodePtr u, WebBrowserNodePtr v);

int
LOGR_is_accessb_bigger(WebBrowserNodePtr u,WebBrowserNodePtr v);

void
LOGR_set_ua_browser(WebBrowserNodePtr wbn,TypeBrowser tb);

void
LOGR_set_ua_version(WebBrowserNodePtr wbn,TypeVersion tv);

void
LOGR_set_ua_platform(WebBrowserNodePtr wbn,TypePlatform tp);

TypePlatform
LOGR_get_ua_platform(WebBrowserNodePtr wbn);

TypeBrowser
LOGR_get_ua_browser(WebBrowserNodePtr wbn);

TypeVersion
LOGR_get_ua_version(WebBrowserNodePtr wbn);

TypePlatform
LOGR_extract_ua_platform(WebBrowserNodePtr wbn);

TypeBrowser
LOGR_extract_ua_browser(WebBrowserNodePtr wbn);

TypeVersion
LOGR_extract_ua_version(WebBrowserNodePtr wbn);


const char *
LOGR_string_browser(WebBrowserNodePtr wbn);

const char *
LOGR_string_version(WebBrowserNodePtr wbn);

const char *
LOGR_string_platform(WebBrowserNodePtr wbn);


#endif


